home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
soniclance.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
5KB
|
709 lines
int Initialize(string type)
{
global int state ;
global real repeatTime = .5;
global int maxBullet = 200;
global int gBulletCount = 20;
global int hitValue = 1;
global int gGravity = 0;
global int gClipSize = 30;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global int gReloadSound = -1;
global real gStopTime = 0.0;
global real gStartTime = 0.0;
global real mBurstDuration = 1.5;
Reset("dumy");
return 0;
}
int Reset(string dummy)
{
state = 0;
SetCollidableProperties(thisObject,gGravity,0);
SetStyle(thisObject,2);
gBulletCount = gClipSize;
SetScale(thisObject,2.0);
wakeupTime = -1.0;
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int reloadsound(string soundname)
{
gReloadSound = GetSoundIndex(soundname);
}
int clipsize(string count)
{
gClipSize = Str2Int(count);
gBulletCount = gClipSize;
}
int GetMaxAmmo(string dummy)
{
ReturnValue(thisObject, gClipSize);
}
int addammo(string count)
{
return 0;
}
int gravity(string flag)
{
int value;
value = Str2Int(flag);
gGravity = value;
SetCollidableProperties(thisObject,gGravity,0);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int repeattime(string str)
{
return 0;
}
int Colliders(string dummy)
{
map::iterator ix;
map objInList;
int value;
objInList = Collisions(thisObject,0,1,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
value = AddObjectTo(first(dereference(ix)),thisObject);
if (value != 0)
{
PlaySound(thisObject,35);
SetScale(thisObject,1.0);
break;
}
}
return 0;
}
int Launch(string dummy)
{
SetScale(thisObject,2.0);
}
int Drop(string dummy)
{
Launch(dummy);
SetCollidableProperties(thisObject,gGravity,0);
SetStyle(thisObject,2);
PlaySound(thisObject,38);
ReturnValue(thisObject,0);
}
int reload(string count)
{
int add;
add = Str2Int(count);
if (add > 0)
{
PlaySound(thisObject,gReloadSound);
gBulletCount += add;
}
}
int AmmoCount(string dum)
{
ReturnValue(thisObject,gBulletCount);
}
int Draw(string ammoCount)
{
return 0;
}
int Pickup(string dummy)
{
return 0;
}
int Holster(string dummy)
{
return 0;
}
int FireFulfill(int notused)
{
real time ;
time = GetTime(thisObject);
state = 2;
wakeupTime = time + repeatTime;
PlaySound(thisObject,gStartSound);
Animate(thisObject,1,"fire");
LaunchEFX(thisObject,0,0);
ParentFire(thisObject);
if (GetHit(thisObject) == 1)
{
HitTarget(thisObject,1.0);
}
else
{
MakeDecal(thisObject,1,0,"scorchdecal",4.0);
}
}
int GetFireTime(string dummy)
{
ReturnValueReal(thisObject,repeatTime);
return 0;
}
int FireStop(string dummy)
{
return 0;
}
int Fire(int flag)
{
real time ;
int retValue = 0;
time = GetTime(thisObject);
if (UnlimitedAmmo(thisObject) == 1)
gBulletCount = gClipSize;
if (state == 0)
{
if (gBulletCount >= 1)
{
state = 2;
gBulletCount--;
FireSaveInfo(thisObject,hitValue,gBulletCount,0.0);
FireCommand(thisObject);
gStopTime = time + mBurstDuration;
gStartTime = time;
retValue = 1;
}
else
{
ParentReloadCommand(thisObject);
}
}
ReturnValue(thisObject,retValue);
return 0;
}
int TimedEvent(int input)
{
real elapseTime;
real time ;
time = GetTime(thisObject);
if (state == 2)
{
if (time > gStopTime)
{
state = 0;
wakeupTime = time + repeatTime;
}
else
{
elapseTime = time - gStartTime;
}
}
else
{
state = 0;
Animate(thisObject,0,"fire");
wakeupTime = -1.0;
}
return 0;
}